#!/bin/sh
# Start or stop ffproxy

# Start ffproxy
ffproxy_start()
{
  if [ -x /usr/sbin/ffproxy ]
  then
    echo "Starting HTTP/HTTPS proxy server:  /usr/sbin/ffproxy"
    /usr/sbin/ffproxy -d
  fi
}

# Stop ffproxy
ffproxy_stop()
{
  killall ffproxy
}

# Restart ffproxy
ffproxy_restart()
{
  ffproxy_stop
  sleep 1
  ffproxy_start
}

case "$1" in
'start')
  ffproxy_start
  ;;
'stop')
  ffproxy_stop
  ;;
'restart')
  ffproxy_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac
